package com.ndp.fb.walle.permission.validation;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import com.ndp.fb.rdb.api.DataPermissionRdbService;
import com.ndp.fb.model.business.vo.BaseVoParam;
import org.springframework.stereotype.Component;

/**
 * Created by yeahmobi on 2015/6/8.
 */
@Component
public class PublishBatchControllerValidation {

    @Reference
    private DataPermissionRdbService dataPermissionRdbService;

    //查询中已经有 usertoken ，不需要再检查
    public boolean searchAllPublishBatch(String usertoken,Object[] args){
        return true;
    }

    //查询中已经有 usertoken ，不需要再检查
    public boolean searchPublishBatchByIds(String usertoken,Object[] args){
        return true;
    }
    public boolean searchPublishBatchDetailInfoById(String usertoken,Object[] args){
        BaseVoParam baseVoParam = JSON.parseObject(args[0].toString(), BaseVoParam.class);
        return  dataPermissionRdbService.userHasAccess(usertoken,"publish_batch","id",String.valueOf(baseVoParam.getId()));
    }
    //查询中已经有 usertoken ，不需要再检查
    public boolean searchName(String usertoken,Object[] args){
        return true;
    }

    //获取临时cache ，不需要再检查
    public boolean publish(String usertoken,Object[] args){
        return true;
    }

    //获取临时cache ，不需要再检查
    public boolean fetchCache(String usertoken,Object[] args){
        return true;
    }
}
